<div class="row">
    <div class="col-lg-12">
        <script>
            $(function () {
                var log = function(s){
                    window.console && console.log(s)
                }
                $('.nav-tabs a:first').tab('show')
                $('a[data-toggle="tab"]').on('show', function (e) {
                    log(e)
                })
                $('a[data-toggle="tab"]').on('shown', function (e) {
                    log(e.target) // activated tab
                    log(e.relatedTarget) // previous tab
                })
            })
        </script>
        <div class="panel panel-primary">
            <div class="panel-heading">
                <strong>用户信息</strong>
            </div>
            <div class="panel-body">


                <ul id="mytab" class="nav nav-tabs">
                    <li class="active"><a href="javascript:; #home" data-toggle="tab">基本资料</a></li>
                    <li><a href="javascript:; #messages" data-toggle="tab">账号&安全</a></li>
                </ul>

                <div class="tab-content">
                    <div class="tab-pane active" id="home">
                        <form class="form-horizontal" role="form" style="margin-top: 20px" ng-submit="updateUserInfo()">
                            <div class="form-group" ng-show="error_msg1">
                                <div class="col-sm-offset-1 col-sm-11">
                                    <div class="alert alert-danger" role="alert">{{error_msg1}}</div>
                                </div>
                            </div>

                            <div class="hidden">
                                <div ng-model="user._id"></div>
                            </div>


                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label left">登录名</label>
                                <div class="col-sm-4">
                                    <div class="center-block" style="padding: 8px 12px">{{user.username}}</div>
                                </div>
                            </div>

                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label left">用户名</label>
                                <div class="col-sm-4">
                                    <input type="text" required="true"  class="form-control" id="realname" placeholder="输入真实姓名" ng-model="user.realname">
                                </div>
                            </div>

                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label left">手机号码</label>
                                <div class="col-sm-4">
                                    <input type="text" required="true"  class="form-control" id="phone" placeholder="输入手机号码" ng-model="user.phone">
                                </div>
                            </div>

                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label">角色</label>
                                <div class="col-sm-4">
                                    <div class="center-block" style="padding: 8px 12px" ng-switch="user.role">
                                        <div  ng-switch-when="1">
                                            管理员
                                        </div>

                                        <div  ng-switch-when="2">
                                            财务
                                        </div>

                                        <div  ng-switch-when="3">
                                            销售
                                        </div>

                                        <div ng-switch-when="4">
                                            外派人员
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group span6" ng-show="user.role == 4">
                                <label class="col-sm-2 col-sm-offset-2 control-label">所属医院</label>
                                <div class="col-sm-4">
                                    <div class="center-block" style="padding: 8px 12px">
                                        {{user.province}}-{{user.hospital.name}}
                                    </div>
                                </div>
                            </div>

                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label text-left">邮箱</label>
                                <div class="col-sm-4">
                                    <div class="center-block" style="padding: 8px 12px">{{user.email}}</div>
                                </div>
                            </div>

                            <div class="form-actions">
                                <button type="submit" class="btn btn-default col-sm-offset-4 col-sm-1">保存</button>
                            </div>
                        </form>
                    </div>
                    <div class="tab-pane" id="messages">
                        <form class="form-horizontal" role="form" style="margin-top: 20px" ng-submit="updatePasswd()">

                            <div class="form-group" ng-show="error_msg2">
                                <div class="col-sm-offset-1 col-sm-11">
                                    <div class="alert alert-danger" role="alert">{{error_msg2}}</div>
                                </div>
                            </div>
                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label left">输入旧密码</label>
                                <div class="col-sm-4">
                                    <input type="password" required="true"  class="form-control" id="oldpasswd" placeholder="输入旧密码" ng-model="oldpasswd">
                                </div>
                            </div>

                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label left">请输入新密码</label>
                                <div class="col-sm-4">
                                    <input type="password" required="true" minlength="6"  class="form-control" id="newpasswd" placeholder="输入新密码" ng-model="newpasswd">
                                </div>
                            </div>

                            <div class="form-group span6">
                                <label class="col-sm-2 col-sm-offset-2 control-label left">再请输入新密码</label>
                                <div class="col-sm-4">
                                    <input type="password" required="true" minlength="6"  class="form-control" id="renewpasswd" placeholder="再次输入新密码" ng-model="renewpasswd">
                                </div>
                            </div>

                            <div class="form-actions">
                                <button type="submit" class="btn btn-default col-sm-offset-4 col-sm-1">确定</button>
                            </div>
                        </form>

                    </div>
                </div>


            </div>
        </div>
    </div>
</div>